﻿@model IEnumerable<HelloMinasan.Web.Song.ViewModels.AdminUsersViewModel>

@helper Truncate(string input, int length)
{
    if(input.Length <length)
    {
        @input
    }
    else
    {
        @input.Substring(0, length)<text>...</text>
    }
}


@if (!String.IsNullOrEmpty((string)TempData["Error"]) || !String.IsNullOrEmpty((string)ViewData["Error"]))
{
    <div id="error" class="error" style="margin: 10px 0px 10px 0px;">
        @(TempData["Error"] ?? ViewData["Error"])<br />
    </div>
}
@if (!String.IsNullOrEmpty((string)TempData["Success"]) || !String.IsNullOrEmpty((string)ViewData["Success"]))
{
    <div id="success" class="success" style="margin: 10px 0px 10px 0px;">
        @(TempData["Success"] ?? ViewData["Success"])<br />
    </div>
}

<table class="tableList" id="tableList">
    <tr>
        <th>User Name</th>
        <th>Display Name</th>
        <th>Email</th>
        <th>Active</th>
        <th>IsClocked</th>
        <th>###</th>
    </tr>
    @if(Model!=null)
    {
    foreach (var item in Model)
    {
        <tr>
            <td>@Html.DisplayFor(n=> item.UserName)</td>
            <td>@Html.DisplayFor(n=> item.DisplayName)</td>
            <td>@Html.DisplayFor(n=> item.Email)</td>
            <td>@Html.DisplayFor(n=> item.Active)</td>
            <td>@Html.DisplayFor(n=> item.IsLocked)</td>
            <td>
                @Html.ActionLink("Active","Active", new{Userid = item.Userid})
                @Html.ActionLink("Clock","Clock", new{Userid = item.Userid}) |
            </td>
        </tr>
    }
    }
</table>

